#include "SH_Cell.h"

SH_Cell::SH_Cell() {
	num = 0;
	state = ~0;
}

SH_Cell::~SH_Cell() {
}

void SH_Cell::setCells(SH_Cell *c1,  SH_Cell *c2,  SH_Cell *c3) {
	next[0] = c1;
	next[1] = c2;
	next[2] = c3;
}

void SH_Cell::setChains(SH_Chain *ch1, SH_Chain *ch2, SH_Chain *ch3) {
	chain[0] = ch1;
	chain[1] = ch2;
	chain[2] = ch3;
}

SH_Cell *SH_Cell::getCell(int direction) {
	return next[direction];
}

SH_Chain *SH_Cell::getChain(int direction) {
	return chain[direction];
}

void SH_Cell::set(int value) {
	num = value;
	
	if (value) state = 0;
	else state = ~0;		
}

int SH_Cell::get() {
	return num;
}

void SH_Cell::appendState(SH_State _state) {
	
	if (num) return;	
	state &= _state;
	
}

SH_State SH_Cell::getState() {
	return state;
}
